SSMS Tips and Tricks 7-1: Changing the default text in new query windows

SSMS Tips and Tricks 7-1: Changing the default text in new query windows

In 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\Microsoft SQL Server Management Studio 21\Release\Common7\IDE\NewFileItems\SQLFile.sql

The file is called SQLFile.sql. If it’s not in the location above, just search for 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 the next time that I click New Query in SSMS, I see this:

If I was really keen, I might also add templated values to be completed.

2025-09-14