Q: What is the best way to run a specific set of queries in order? I have 50 or so queries that all need to be run in a specific order.  I just want to set up a Procedure that will run them in the order I need.  Is there a way to call the .sql files I have saved as I don't want to have to make changes each month to one large lump of code?  I'd prefer to make changes to each specific query as needed that way the Procedure does not need to be modified.

A: Instead of using a stored procedure you can write a SQLCMD script that will execute .sql files stored on the file system:
:setvar path "c:\path_to_your_sql_files"
:on error exit

USE [YOUR_DB_NAME]
GO

SET XACT_ABORT ON
GO

BEGIN TRANSACTION

    go
    :r $(path)/"SCRIPT001.sql"
    go
    :r $(path)/"SCRIPT002.sql"
    go
    :r $(path)/"SCRIPT003.sql"
    go

COMMIT TRANSACTION

If you run this inside SSMS remember to enable "SQLCMD Mode" inside "Query" menu.
