Over the years I have seen code samples to demonstrate topics like backup/restore or re-indexing. Most of these samples (including the re-indexing sample in SQL Server Books On-line!), require to store code in each database running on the SQL Server instance.
As a programmer I want to try to avoid as much duplicate code as possible, so that is why I usually create a very small database per SQL Server instance containing all of the code I want to execute. No tables.
Think of it as a code catalog
I also include this database in my backups jobs to my work on coding is safe and secure
All of the T-SQL code I’m planning to present on this blog uses this approach.