Within the SSMS Code Editor (for SQL Server 2012) I have this code written within the editor, that has a Dark theme applied. When you click on a variable, SSMS highlights all the other occurrences of that variable in scope. Notice that the variable highlighting colour is quite dark against the background.

SSMS Dark Theme

Within the Tools > Options > Fonts and Colors menu, can anyone tell me which is the correct Display items choice to edit this colour? I've been through all of the ones that I can see that roughly match the same colour, but none actually effect the code.


Variable colors share settings with table, object and other names. So you can change the text color using Identifier:

enter image description here

Just note that it will also affect table names, column names etc.

enter image description here

For the highlighted color of identifiers and variables, use Selected Text. The highlights will use a slightly muted version of that color.

And no, these are not my current settings, and I only kept them that way long enough to grab a screen shot...

  • Hi Aaron. I was more referring to the highlighting that occurs when you click on a variable, and SSMS highlights all other occurrences of that variable in scope. You're setting does work, but then SSMS loses the ability to highlight scope variables. Is that expected behaviour? BTW I read your blog yesterday on OUTPUT VS SELECT VS RETURN - excellent article! – EvilDr Aug 14 '14 at 7:51
  • 1
    @EvilDr Ok, so is the highlighted background color not just based on the Selected Text option? In 2014 I no longer get highlighting based on the variable selected. If you are using snippets then I would suggest trying Code Snippet Field. Others possibly worth trying: Highlighted Reference, Template Parameter, Text. – Aaron Bertrand Aug 14 '14 at 14:29
  • You nailed it! Yes, its based on Selected Text, but shows a lighter shade of that respective colour. Frustrating that it can't be referenced directly! Anyhow, I set the option to Automatic and it produces a fairly subtle (but easy-to-see) blue. I consider that a success! Thanks very much and keep up the excellent work! – EvilDr Aug 14 '14 at 15:29
  • @AaronBertrand, It's lame that text highlighting isn't available SSMS 2014. Do you know if there's a way to enable this? – RayLoveless Aug 15 '16 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.