IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'enableAggregation'
      AND Object_ID = Object_ID(N'pal_Report'))
BEGIN
    ALTER TABLE pal_Report
	ADD enableAggregation BIT; 
END


IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'aggregationType'
      AND Object_ID = Object_ID(N'pal_ReportField'))
BEGIN
    ALTER TABLE pal_ReportField
	ADD aggregationType int NULL; 
END



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

