Rajendra Gupta
Use Custom color

How to set custom colors in the SSMS status bar

February 19, 2020 by

This article explains the process of defining custom color codes for SQL Server connections in SSMS.


DBAs or developers might work simultaneously with different environments such as production, UAT, staging, development. Sometimes, you might execute a query in a different environment in case you miss to check the environment. We should always be careful as accidentally query execution might put you in trouble. For example, in a development environment, we might drop a few objects without worrying much. If the same object exists in the production database as well and you accidentally run the query in production, you are in big trouble.

Specify custom colors for SSMS connection

Be careful while running any query. You can verify the connected instance using the status bar of SSMS. Each new query window provides the connection details.

In the following screenshot, we verify connected SQL instance as well as an authenticated user:

Status bar of SSMS

SSMS provides a solution for us to determine the environment as per the environment color coding. For example, we can set a red color for production, yellow for development, etc.

Usually, we launch SSMS, specify the SQL instance, and connect to the respective SQL Server.

SSMS connection

Click on Options, and you get various configuration tabs in SSMS.

Various tabs for connection properties

Let’ have a quick overview of these tabs of SSMS:

  • Login: It is the default connection window of SSMS. We specify the following configurations:
    • Server type: Type of the SQL Service we want to connect, such as database engine, Analysis Service, Integration services, and reporting services
    • Server Name: It is the SQL instance name. For a default instance, we can specify a dot(.) or MSSQLSERVER. For a named instance, enter the SQL instance in the format of [Server\SQLInstance]. If you use a SQL port other than the default, specify that port number as well as [Server\SQLInstance:Port]
    • Authentication: We can choose the authentication mechanism, either Windows or SQL authentication. For SQL authentication, specify SQL user and password details
  • Always Encrypted: We use this option if using SQL Server Always Encrypted feature
  • Additional Connection parameters
  • Connection Properties: In this connection properties, We can use the following optional configurations

    Connection Properties

    • Connect to database: If we want to connect to a specific database, we can use this option, browse the server and select the required database. If we do not specify any database, the user gets a connection to the default database specified in the SQL logins

      Connect to database

    • Network protocol and network packet sizes: Here, we can choose the network protocol and packet size. You should change this property only on specific requirements
    • Connection time out and execution time out: We can configure the connection and execution time outs value in seconds in these values
    • Encrypt connection: if we use encrypted SQL connections, we can put a tick on this. Your SQL instance should be configured for the encrypted connection before using this option
    • Use Custom color: Usually, we do not use this option much, but it can prevent us from accidental query execution in the wrong SQL instance

Put a check on Use custom color and select a color from the available colors:

Use Custom color

Now, connect the database instance and view the query pane. Notice the difference. You get a custom color code for the status bar. This way, you can easily visualize that this connection belongs to a production SQL instance. Similarly, you can configure color codes for other databases while connecting using SSMS:

custom color code for the status bar

Local Server groups and custom status bar color

In the previous step, we specified the custom status bar color while connecting it using SSMS. Usually, DBAs register the supported SQL instances using the local server groups. We can create multiple server groups in various groups such as application group, environment group depending upon an individual’s requirements.

We can click on the Local Server Groups from the registered servers, as shown below:

Local Server groups and custom status bar color

Right-click on the Local Server Groups and click on the New Server Group. Specify the group name (mandatory) and group description (optional):

New Server Group

Similarly, create another group Staging: create another group Staging

We have two local server groups, as shown below:

local server groups

We can register the servers in the individual group. To register a server, right-click on the group name and click New Server Registration:

New Server Registration

It opens the SSMS connection window. We can define the SQL Server connection along with server color coding. Save the connection, and it reflects in the corresponding server group:

define the SQL Server connection

In the following screenshot, we see both production and staging local server group contains server registered. We have defined different color codes for the ribbon bar while saving the connection. The benefit of using a local server group is that it is a one-time activity. Once we have defined connection properties, we can easily connect to that instance group without any additional configurations:

connection properties for groups

Now, connect to servers from both production and staging local server groups. Open a new query window in both connections and notice the different color codes for both instances:

verify different color codes

Important points

  • We can customize color codes for the database engine connections. We cannot use it for Analysis Services, Reporting Services, and Integration
  • Ribbon bar color codes is a local SSMS feature. If you use different SSMS, you will get default color codes
  • You should use different colors for a separate environment to avoid any confusion


You might have heard a famous saying – “Prevention Is Better Than Cure”. It applies to databases as well. You should always check the connections before executing a query. You can also use this article reference for customizing the ribbon bar color codes as per the environment in SSMS.

Rajendra Gupta
SQL Server Management Studio (SSMS)

About Rajendra Gupta

As an MCSA certified and Microsoft Certified Trainer in Gurgaon, India, with 13 years of experience, Rajendra works for a variety of large companies focusing on performance optimization, monitoring, high availability, and disaster recovery strategies and implementation. He is the author of hundreds of authoritative articles on SQL Server, Azure, MySQL, Linux, Power BI, Performance tuning, AWS/Amazon RDS, Git, and related technologies that have been viewed by over 10m readers to date. He is the creator of one of the biggest free online collections of articles on a single topic, with his 50-part series on SQL Server Always On Availability Groups. Based on his contribution to the SQL Server community, he has been recognized with various awards including the prestigious “Best author of the year" continuously in 2020 and 2021 at SQLShack. Raj is always interested in new challenges so if you need consulting help on any subject covered in his writings, he can be reached at rajendra.gupta16@gmail.com View all posts by Rajendra Gupta