IF NOT EXISTS (SELECT 1 
			FROM	dbo.pal_Template
			WHERE	templateTypeId = 3
					AND	templateName = 'Event Notification')
BEGIN
	INSERT INTO dbo.pal_Template (   templateTypeId ,
	                                 templateName ,
	                                 templateContent
	                             )
	VALUES (   3 ,  -- templateTypeId - int
	           'Event Notification' , -- templateName - varchar(250)
	           N'Dear {contactName}. Please attend {eventName} on {eventDate}.'  -- templateContent - ntext
	       )
END

IF EXISTS ( SELECT * 
            FROM   sysobjects 
            WHERE  id = object_id(N'[dbo].[sp_SetItemLabelValuesSelf]') 
                   and OBJECTPROPERTY(id, N'IsProcedure') = 1 )
BEGIN
    DROP PROCEDURE [dbo].[sp_SetItemLabelValuesSelf]
END

IF EXISTS ( SELECT * 
            FROM   sysobjects 
            WHERE  id = object_id(N'[dbo].[sp_SetSurfaceDataItemFromLinks]') 
                   and OBJECTPROPERTY(id, N'IsProcedure') = 1 )
BEGIN
    DROP PROCEDURE [dbo].[sp_SetSurfaceDataItemFromLinks]
END

