IF NOT EXISTS(
    SELECT * FROM sys.columns 
    WHERE Name      = N'filterField'
      AND Object_ID = Object_ID(N'pal_CalendarEvent'))
BEGIN
    ALTER TABLE pal_CalendarEvent
	ADD filterField VARCHAR(255) NULL; 
END

IF NOT EXISTS(
    SELECT * FROM sys.columns 
    WHERE Name      = N'filterValue'
      AND Object_ID = Object_ID(N'pal_CalendarEvent'))
BEGIN
    ALTER TABLE pal_CalendarEvent
	ADD filterValue VARCHAR(255) NULL; 
END

IF EXISTS(
    SELECT * FROM sys.columns 
    WHERE Name      = N'filterField'
      AND Object_ID = Object_ID(N'pal_CalendarEventModule'))
ALTER TABLE [dbo].[pal_CalendarEventModule] DROP COLUMN [filterField];

IF EXISTS(
    SELECT * FROM sys.columns 
    WHERE Name      = N'filterValue'
      AND Object_ID = Object_ID(N'pal_CalendarEventModule'))
ALTER TABLE [dbo].[pal_CalendarEventModule] DROP COLUMN [filterValue];

