At the moment we are trialing the use of SQL Prompt to perform code analysis and formatting. This was pretty much the only tool we could find that could format and analyse T-SQL that worked. We tried a few free ones but these were not very good and only did basic formatting, not code analysis. A 28 day trial version can be downloaded from https://www.red-gate.com/products/sql-development/sql-prompt/.
SQL Prompt has the following funtionality
- Advanced IntelliSense-style code completion
- Code snippet library
- Refactor SQL code
- Fast and comprehensive code analysis
- SSMS tab history and coloring
- Advanced customizable and sharable code formatting
Follow these links for SQL Prompt's Documentation and the Code Analysis Rules it uses.
We trialed SQL Prompt over 2 weeks and have found it very good at tidying up code and making it consistent. We also found thats it's other features made writing T-SQL quicker & easier. Although we were happy with its settings straight out of the box these can be changed and shared easily.
More trialing by other T-SQL developers would be useful before any decisions are made.