if not exists(select * from sys.tables t join sys.columns c on c.object_id = t.object_id where t.name = 'T_PLAN_CUT_DICTIONARY' and c.name = 'CutPlanSection')
ALTER TABLE [IES].[T_PLAN_CUT_DICTIONARY] ADD [CutPlanSection] uniqueidentifier NULL
GO

if not exists(select * from sys.foreign_keys fk where fk.name = 'FK_T_PLAN_SECTION_T_PLAN_CUT_DICTIONARY_CutPlanSection')
ALTER TABLE [IES].[T_PLAN_CUT_DICTIONARY] ADD CONSTRAINT [FK_T_PLAN_SECTION_T_PLAN_CUT_DICTIONARY_CutPlanSection]
FOREIGN KEY([CutPlanSection]) REFERENCES [IES].[T_PLAN_SECTION] ([PlanSectionID])
GO
