IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'eraFromPeriod'
		AND Object_ID = Object_ID(N'pal_MSEra'))
BEGIN
	ALTER TABLE pal_MSEra
		DROP COLUMN eraFromPeriod
END


IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'eraToPeriod'
		AND Object_ID = Object_ID(N'pal_MSEra'))
BEGIN
	ALTER TABLE pal_MSEra
		DROP COLUMN eraToPeriod
END


IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'totalPaymentAmount'
		AND Object_ID = Object_ID(N'pal_MSEra'))
BEGIN
	ALTER TABLE pal_MSEra
		DROP COLUMN totalPaymentAmount
END


IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'depositReference'
		AND Object_ID = Object_ID(N'pal_MSEraBankDeposit'))
BEGIN
	ALTER TABLE pal_MSEraBankDeposit
		DROP COLUMN depositReference
END


IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'payorName'
		AND Object_ID = Object_ID(N'pal_MSEraBankDeposit'))
BEGIN
	ALTER TABLE pal_MSEraBankDeposit
		DROP COLUMN payorName
END


IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'paidFromAccountNumber'
		AND Object_ID = Object_ID(N'pal_MSEraBankDeposit'))
BEGIN
	ALTER TABLE pal_MSEraBankDeposit
		DROP COLUMN paidFromAccountNumber
END


IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'paidFromBranchCode'
		AND Object_ID = Object_ID(N'pal_MSEraBankDeposit'))
BEGIN
	ALTER TABLE pal_MSEraBankDeposit
		DROP COLUMN paidFromBranchCode
END


IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'paidFromBankName'
		AND Object_ID = Object_ID(N'pal_MSEraBankDeposit'))
BEGIN
	ALTER TABLE pal_MSEraBankDeposit
		DROP COLUMN paidFromBankName
END


IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'openingBalance'
		AND Object_ID = Object_ID(N'pal_MSEraBankDeposit'))
BEGIN
	ALTER TABLE pal_MSEraBankDeposit
		DROP COLUMN openingBalance
END


IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'closingBalance'
		AND Object_ID = Object_ID(N'pal_MSEraBankDeposit'))
BEGIN
	ALTER TABLE pal_MSEraBankDeposit
		DROP COLUMN closingBalance
END


IF EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'memberAccountNo'
		AND Object_ID = Object_ID(N'pal_MSEraMember'))
BEGIN
	ALTER TABLE pal_MSEraMember
		DROP COLUMN memberAccountNo
END




IF NOT EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'totalPaidToMember'
		AND Object_ID = Object_ID(N'pal_MSEraMember'))
BEGIN
	ALTER TABLE pal_MSEraMember
		ADD totalPaidToMember DECIMAL(18,2) NULL;
END




IF NOT EXISTS(SELECT * FROM sys.columns 
		WHERE Name = N'totalPatientLiablePortion'
		AND Object_ID = Object_ID(N'pal_MSEraMember'))
BEGIN
	ALTER TABLE pal_MSEraMember
		ADD totalPatientLiablePortion DECIMAL(18,2) NULL;
END