Whenever we launch SQL Server Management Studio, it will load “SQLFile.sql” from the operating system and shows the text in the New Query Window. The location of this file depends on the version of sql server and the bit of your local machine. Here is the location of SQLFile.sql on my 64 bit machine for SQL 2012: C:\ProgramFiles(x86)\Microsoft\SQLServer\110\Tools\Binn\ManagementStudio\SqlWorkbenchProjectItems\Sql\SQLFile.sql
If you are running 32 bit operating system, then just remove the (x86) for 32-bit installations,so the location of SQLFile.sql should be: C:\ProgramFiles\MicrosoftSQLServer\110\Tools\Binn\ManagementStudio\SqlWorkbenchProjectItems\Sql\SQLFile.sql
Here is the mapping of SQL versions and internal version numbers.
- Microsoft SQL Server 2014 120
- Microsoft SQL Server 2012 110
- Microsoft SQL Server 2008 R2 100
- Microsoft SQL Server 2008 100
Then, edit the file in any editor(Notepad++), put any default comment that you want to be there whenever you create a New Query. On my machine, I have modified the file and written below.
select @@version
go
select @@servername
After modifying, whenever you open new query windows, it would be as below.