This is an extension to format SQL sentences. It is written in C# and supports Visual Studio 2019 and Microsoft SQL Server Management Studio 18.
https://marketplace.visualstudio.com/items?itemName=YazhongZhang.SQLFormatter
The command is in Tools menu, shown in the figure.
Also, the default keyboard shortcut is ALT + F.