- Unzip the SortSQLFilesInProject.zip file into a folder (in the example on the right I have unzipped it to C:\SSMSUtilities)
- In SQL Server Management Studio, Select the External Tools item from the Tools Menu and you will see a dialog box similar to the one on the right of this page
- Fill out the dialog as indicated in the image on the right (Modify the Command to point to the folder where you unzipped the SortSQLFilesInProject.exe executable)
- Make sure you select the Use Output Window checkbox
- Click Add and repeat in order to add the descending sort and make sure to change the Arguments from "$(SolutionFileName) Asc" to "$(SolutionFileName) Desc"
- Close the dialog by clicking OK and you should now see two new options in the Tools Menu (im my case they are called SortFiles Asc and SortFiles Desc) which you can use to sort SQL files in projects.
To add buttons to the SSMS toolbar for these commands simply select the Customize item from the Tools menu in SSMS
- Select Tools in the Categories List
- Select External Command 1 in the Commands list
- Select and drag External Command 1 onto a tool bar
- Right click on the new External Command 1 button and edit the Name property to SortFiles Asc
- Repeat for External Command 2

|