IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'eraClaimItemId'
		AND Object_ID = Object_ID(N'pal_MSEraClaimItemAccount'))
BEGIN
	ALTER TABLE pal_MSEraClaimItemAccount
		ALTER COLUMN eraClaimItemId VARCHAR(MAX) NULL;
END




IF EXISTS ( SELECT * 
            FROM   sys.views 
            WHERE  name='pal_vRemittanceListing' and type='v')
BEGIN
    DROP VIEW [dbo].[pal_vRemittanceListing]
END




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





IF EXISTS ( SELECT * 
            FROM   sys.views 
            WHERE  name='pal_vAccountUnprocessedEra' and type='v')
BEGIN
    DROP VIEW [dbo].[pal_vAccountUnprocessedEra]
END



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



IF NOT EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'procedureCode'
		AND Object_ID = Object_ID(N'pal_MSEraClaimItem'))
BEGIN
	ALTER TABLE pal_MSEraClaimItem
		ADD procedureCode NVARCHAR(50) NULL;
END




IF NOT EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'nappiCode'
		AND Object_ID = Object_ID(N'pal_MSEraClaimItem'))
BEGIN
	ALTER TABLE pal_MSEraClaimItem
		ADD nappiCode NVARCHAR(50) NULL;
END