For those of us who are "full stack" developers, we often have to deal with other people's code. This can mean that we get code that is poorly formatted or has lost formatting due to an export or some other reason. Here are some tools that may help you out.
Both of these tools are supplied by Tao Klerks - http://architectshack.com/PoorMansTSqlFormatter.ashx. Poor Man's TSQL Formatter tool to format transact SQL based on configurable options. People can be quite vocal about their SQL formatting preferences, so this tool lets you choose how you want your SQL to look.
Firstly, there is an MSI which will install a plugin directly into SQL Server Management Studio which is really helpful.
Secondly, I am a Notepad++ advocate, so another "Poor Man" tool is a plugin for that notepad replacement. Notepad++ is like Notepad on steroids. It gives a lot more functionality than the Windows-supplied text editor. This plugin lets you paste some TSQL into the Notepad window and format it.
Feel free to check out the developers site at http://architectshack.com/PoorMansTSqlFormatter.ashx.
Til next time ...