IF EXISTS (
	SELECT * 
	FROM sys.indexes 
	WHERE name = 'UQ_T_SCHET_USL_OmsSchetUsl'
		AND object_id = OBJECT_ID('IES.T_SCHET_USL')
)
BEGIN
	DROP INDEX [UQ_T_SCHET_USL_OmsSchetUsl] ON [IES].[T_SCHET_USL] 
END

IF EXISTS (
	SELECT * 
	FROM sys.foreign_keys 
	WHERE name = 'FK_T_SCHET_USL_T_SCHET_USL_OmsSchetUsl'
	   AND parent_object_id = OBJECT_ID(N'IES.T_SCHET_USL')
)
BEGIN
	ALTER TABLE [IES].[T_SCHET_USL] DROP CONSTRAINT [FK_T_SCHET_USL_T_SCHET_USL_OmsSchetUsl]
END

IF EXISTS(
	SELECT * 
	FROM sys.indexes 
	WHERE name='IX_SCHET_USL_OmsSchetUsl' 
		AND object_id = OBJECT_ID('IES.T_SCHET_USL')
)
BEGIN
	DROP INDEX [IX_SCHET_USL_OmsSchetUsl] ON [IES].[T_SCHET_USL]
END

alter table IES.T_SCHET_USL
drop column OmsSchetUsl