IF EXISTS (SELECT * FROM sys.foreign_keys WHERE [name] = 'FK_T_SCHET_USL_ONK_LEK_PR_T_SCHET_USL_ONK_LEK_PR_INJ_SchetUslOnkLekPr') 
ALTER TABLE [IES].[T_SCHET_USL_ONK_LEK_PR_INJ] DROP CONSTRAINT [FK_T_SCHET_USL_ONK_LEK_PR_T_SCHET_USL_ONK_LEK_PR_INJ_SchetUslOnkLekPr];

IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE [name] = 'FK_T_SCHET_USL_ONK_LEK_PR_T_SCHET_USL_ONK_LEK_PR_INJ_SchetUslOnkLekPr') 
ALTER TABLE [IES].[T_SCHET_USL_ONK_LEK_PR_INJ]  WITH CHECK ADD  CONSTRAINT [FK_T_SCHET_USL_ONK_LEK_PR_T_SCHET_USL_ONK_LEK_PR_INJ_SchetUslOnkLekPr] FOREIGN KEY([SchetUslOnkLekPr]) REFERENCES [IES].[T_SCHET_USL_ONK_LEK_PR] ([SchetUslOnkLekPrID]) ON DELETE CASCADE;