SSMS Tips and Tricks 4-2: Using colors to avoid running scripts against the wrong server

Everyone who’s worked with SQL Server for any length of time, has had the experience of executing a T-SQL script, and then noticing, with horror, that they’ve just executed the script against the wrong server.
You know the feeling. It even happens at Christmas time, just when you were hoping to get away from work for a few days, or when you are the unlucky one who’s doing on call work.
Many of these surprises would be avoided if there was something that gave you a visual clue that you were connected to the wrong server.
SSMS has had an option to color code connections to servers for quite a while. The solution isn’t perfect and isn’t as good as Mladen Prajdić’s SSMS Tools Pack:
https://www.ssmstoolspack.com/
(If you’re keen to pay for an add-in, I do recommend that one)
For many people though, the colorizing provided by SSMS is just enough. And it’s easy to use. In previous versions of SSMS, you needed to click Options when you opened a new database connection.
That opened a larger dialog that allowed you to specify a color for the connection:
In the new connection dialog, the color option is now right on the front page for the connection:
I’ve chosen Red to warn me that this is a production server. You can even use the Custom button to pick a custom color.
Then, once you open a query window, you’ll see the color bar at the bottom.
2025-08-01