Tengo un sistema que usa un disparador DDL exactamente para este tipo de cosas. Funciona lo suficientemente bien para mis necesidades. Originalmente se desarrolló en Sql Server 2005 y ahora reside en un sistema Sql Server 2008R2. Es similar al que se describe en el enlace del comentario de Aaron Bertrand.
Cree una tabla similar a esta.
CREATE TABLE [dbo].[SchemaLog](
[SchemaLogID] [int] IDENTITY(1,1) NOT NULL,
[PostTimeUtc] [datetime] NOT NULL,
[DatabaseUser] [nvarchar](128) NOT NULL,
[Event] [nvarchar](128) NOT NULL,
[Schema] [nvarchar](128) NULL,
[Object] [nvarchar](128) NULL,
[TSQL] [nvarchar](max) NOT NULL,
[XmlEvent] [xml] NOT NULL,
CONSTRAINT [PK_SchemaLog_1] PRIMARY KEY CLUSTERED
(
[SchemaLogID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Asegúrese de que todos tengan permisos de inserción en la tabla y luego cree un disparador ddl similar a este.
CREATE TRIGGER [ddlDatabaseTriggerLog] ON DATABASE FOR DDL_DATABASE_LEVEL_EVENTS AS
BEGIN
SET NOCOUNT ON;
DECLARE @data XML;
DECLARE @schema sysname;
DECLARE @object sysname;
DECLARE @eventType sysname;
SET @data = EVENTDATA();
SET @eventType = @data.value('(/EVENT_INSTANCE/EventType)[1]', 'sysname');
SET @schema = @data.value('(/EVENT_INSTANCE/SchemaName)[1]', 'sysname');
SET @object = @data.value('(/EVENT_INSTANCE/ObjectName)[1]', 'sysname')
IF @object IS NOT NULL
PRINT ' ' + @eventType + ' - ' + @schema + '.' + @object;
ELSE
PRINT ' ' + @eventType + ' - ' + @schema;
IF @eventType IS NULL
PRINT CONVERT(nvarchar(max), @data);
INSERT [dbo].[SchemaLog] (
[PostTimeUtc]
, [DatabaseUser]
, [Event]
, [Schema]
, [Object]
, [TSQL]
, [XmlEvent] )
VALUES (
GETUTCDATE()
, CONVERT(sysname, CURRENT_USER)
, @eventType
, CONVERT(sysname, @schema)
, CONVERT(sysname, @object)
, @data.value('(/EVENT_INSTANCE/TSQLCommand)[1]', 'nvarchar(max)')
, @data );
END;
Ver para seleccionar cambios en orden
create view SchemaLogOrdered
as
SELECT top 10000 *
FROM dbo.SchemaLog
ORDER BY SchemaLogID DESC