SELECT 'insert [msdb].[dbo].[sysnotifications] (alert_id, operator_id, notification_method)
select (select id FROM [msdb].[dbo].[sysalerts] WHERE NAME = ''' + a.name + ''') as alert_id,
(select id from [msdb].[dbo].[sysoperators] o where name = ''' + o.name + ''') as operator_id,
' + CAST(n.notification_method AS VARCHAR) + ' as notification_method
GO'
FROM [msdb].[dbo].[sysnotifications] n INNER JOIN [msdb].[dbo].[sysoperators] o ON n.operator_id = o.id
INNER JOIN [msdb].[dbo].[sysalerts] a ON n.alert_id = a.id