Shortcut: Change default text in new query window in SSMS

In SQL Server Management Studio (SSMS), when you click New Query, a new query window is opened, but because it’s blank, what might not be immediately obvious is that it’s based on a template.
The location of the template depends upon the version, but for SSMS 17.6, you’ll find it in this folder:
C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\SqlWorkbenchProjectItems\Sql
The file is called SQLFile.sql.
One of the things that I often forget to do is to change my connection to the correct database. Let’s add a USE statement to make that obvious.
I’ve also put a BEGIN TRAN that I might use before doing any ad-hoc modifications.
So I save that file, and when I do my next New Query in SSMS, I see this:
If I was really keen, I might also add templated values to be completed.
2019-02-07