CREATE PROCEDURE dbo.EnableAuditLog @AEnable BIT AS
SET NOCOUNT ON

DECLARE @string VARCHAR(8000)
DECLARE @tableName NVARCHAR(500)

DECLARE cur CURSOR FOR
  SELECT name 
  FROM sysobjects 
  WHERE id IN (SELECT parent_obj FROM sysobjects WHERE xtype='tr')
OPEN cur

FETCH NEXT FROM cur INTO @tableName

WHILE @@fetch_status = 0
BEGIN
  IF @AEnable = 1
    SET @string ='ALTER TABLE '+ @tableName + ' ENABLE TRIGGER ALL'
  ELSE
    SET @string ='ALTER TABLE '+ @tableName + ' DISABLE TRIGGER ALL'
  EXEC (@string)
  
  FETCH NEXT FROM cur INTO @tableName
END

CLOSE cur
DEALLOCATE cur