I love learning new things. I feel like a kid again at times, my eyes get wide as I imagine new possibilities using whatever things it is I have found. This is how I felt last week when I came across a feature of SQL Server Management Studio (SSMS) that I had not seen before despite it having existed since SQL 2005.
Yeah, that’s right, since 2005. Ten years. Ten long years of not knowing.
I’m not ashamed to admit that I don’t know everything. And I bet there’s someone reading this post (if not today, then someday they will) who never knew about this feature either.
The feature is embedded inside of the templates feature in SSMS. So let’s start there, as I know this is also a little-used feature. You can access the templates with SQL Server Management Studio from the main menu, under View, like so:
Selecting “Template Explorer” will open up the Template Browser on the right-hand side of SSMS and reveal dozens of available templates for you to use:
I’m going to select “Extended property” because who doesn’t love metadata, amirite? I will select “Add Extended Properties to Table” as you see here:

Doing so will open up the template in a new query window inside of SSMS. In this example what you should see is this:

This is where my day suddenly became full of awesome. I found out that I can specify the values for all of the parameters in the script and have them replaced automatically! Go to the Query menu and you will see this option:
That will launch this dialogue box:
And here is where I saw real value. I don’t need to supply literal values here. I could put in variables instead. That means I could use these templates as a way to generate scripts to use for Powershell or SQLCMD (for those of us that still like it old-school).
And this is what the finished product looks like:
Sometimes, it’s the simple things in life, you know what I mean?
Enjoy!




