IF NOT EXISTS(SELECT 1 FROM sys.columns
          WHERE Name = N'EmdrBaseObjectEnt'
          AND Object_ID = Object_ID(N'AKUZ.T_CARD_NOTE'))
BEGIN
    ALTER TABLE [AKUZ].[T_CARD_NOTE] ADD [EmdrBaseObjectEnt] int NULL

	ALTER TABLE [AKUZ].[T_CARD_NOTE] ADD CONSTRAINT [FK_T_ENTITIES_T_CARD_NOTE_EmdrBaseObjectEnt]
	FOREIGN KEY([EmdrBaseObjectEnt]) REFERENCES [VCLib].[T_ENTITIES] ([EntityID])
END