
Command-line utility that lets you format any number of files in bulk, or format from some other arbitrary program - for windows (.Net) or any environment (node/npm).
Notepad++ plugin, for quick single-key formatting in your favorite general-purpose text editor. SSMS (SQL Server Management Studio) and Visual Studio Addin/Extension that allows you to format the current file or selected text with a single hotkey - supports any version of SSMS or SSMS Express, and any Full (not Express) version of Visual Studio. Available ready-to-use in a variety of forms.
Also provides "minifier" option to strip out comments and whitespace, to obfuscate rather than pretty-print your code. Optionally outputs "colorized" html code rather than just the formatted SQL. Provides formatting options to cater to different common formatting styles/standards. Handles complete multi-batch scripts, including object definition scripts such as stored procedures, triggers, etc.
This is a free and open-source SQL (T-SQL) formatter: