I find myself often needing to have some kind of audit trail for a table in SQL Server, i.e. some way to look at before-and-after data, who changed it, when, etc. I've set up enough of these manually that they were becoming formulaic, so I figured why not put together a procedure that creates them for me and writes the necessary trigger?
Attached is the version I'm currently using. The syntax is pretty simple. Here's an example, a real one that I just set up:
EXEC sp_CreateDataAudit 'dbo', 'IV00200', 'audit', 'IV00200', NULL, 'tr_IV00200_Audit', 'SERLNMBR,UNITCOST,RCTSEQNM ...