if not exists (select * from VCLib.T_ENTITIES where BaseEntity = (select EntityId from VCLib.T_ENTITIES where EntName = 'NEWS_BOX' and [Schema] = 'VCLib'))
BEGIN
	IF EXISTS (
        SELECT 1
        FROM sys.foreign_keys
        WHERE name = 'FK_T_ENTITIES_T_NEWS_BOX_type_'
          AND parent_object_id = OBJECT_ID('VCLib.T_NEWS_BOX')
    )
	begin
		ALTER TABLE VCLib.T_NEWS_BOX drop constraint FK_T_ENTITIES_T_NEWS_BOX_type_
	end
	IF EXISTS(SELECT 1 FROM sys.columns 
          WHERE Name = N'type_'
          AND Object_ID = Object_ID(N'VCLib.T_NEWS_BOX'))
	BEGIN
		ALTER TABLE VCLib.T_NEWS_BOX drop column type_
	end
END