USE [msdb]
GO

DECLARE @namespace NVARCHAR(255)
   = N'\\.\root\Microsoft\SqlServer\ServerEvents\' + COALESCE
   (
       CONVERT(NVARCHAR(32), SERVERPROPERTY('InstanceName')),
       N'MSSQLSERVER'
   );

IF NOT EXISTS(SELECT 1 FROM msdb.dbo.sysalerts WHERE [name] = N'DBA - Audit Login')
BEGIN
  EXEC msdb.dbo.sp_add_alert @name=N'DBA - Audit Login', 
	  	@message_id=0, 
	  	@severity=0, 
	  	@enabled=1, 
  		@delay_between_responses=0, 
  		@include_event_description_in=0, 
  		@category_name=N'[Uncategorized]', 
  		@wmi_namespace= @namespace, 
  		@wmi_query=N'SELECT * FROM AUDIT_LOGIN_FAILED', 
  		@job_name=N'_92020 - Audit Login'
END
GO