In case anyone is interest my LogScriptRun SProc works as follows:
Parameters:
- SProc / Script name
- Version - typically yymmdd - varchar(10)
Optional:
- Action - NULL=Insert into log, "LIST"=Display history of Script Run
- LastRun - 1=Show run dates (we have a log table of all SProc executions)
Running the Sproc with just SProc Name parameter defaults to displaying the history, so
EXEC my_SP_LogScriptRun 'MySprocName' , '20160326'
will run the whole command when the script is executed (and log the CREATE SProc), but if I highlight just the EXEC and MySprocName I can get the Current Version and History
Actions:
Display warnings:
- SProc parameter NULL/missing = display Command Help reminder
- Running inside a transaction
- Name contains invalid characters (according to our House Rules)
- Check master.dbo.spt_values are at desired settings - e.g. ansi_nulls=ON, implicit_transactions=OFF
LIST mode:
If the object does not exist display a warning. There might still be entries in the History, but the object does not currently exist. (Thus the Sproc can be used as as useful "Exists?" check.
Modify Date is older then Script Log record. Because we do EXEC my_SP_LogScriptRun followed by ALTER/CREATE MySProc there is the possibility that the CREATE fails. We prefer to have the logging SProc at the top of the script, so it is easy to use for History List and to change the Version Number, but obviously it can't check that the Sproc exists at that point.
So to this I could add:
List any, open, records in Issue Tracking database 
Rollout:
During rollout (e.g. DEV to QA, and QA to PRODUCTION) we compare the latest entry, for each object in the log, between the two databases - which brings to light if we have run a script for the wrong version, or have an object present in one DB and not the other.
Usage:
PRINT 'Create procedure MySProcName' -- '
GO
EXEC dbo.my_SP_LogScriptRun 'MySprocName' , '20160326'
GO
-- DROP PROCEDURE dbo.MySProcName
IF OBJECT_ID(N'[dbo].[MySProcName]', N'P') IS NULL
EXEC ('CREATE PROC dbo.MySProcName AS SELECT ''MySProcName:stub version, to be replaced''')
GO
ALTER PROCEDURE dbo.MySProcName
... code here ...
GO
IF OBJECT_ID(N'[dbo].[MySProcName]', N'P') IS NOT NULL
GRANT EXECUTE ON dbo.MySProcName TO MyRole
GO
PRINT 'Create procedure MySProcName DONE'
GO