declare @table_name nvarchar(64)
declare @column_name nvarchar(64)

set @table_name = 'acc_transactions'
set @column_name = 'atrn_check_auto_deposit' 

IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE  TABLE_NAME=@table_name AND COLUMN_NAME=@column_name )
begin
	delete from md_dictionaries_fields where dictf_table_name = @table_name and dictf_field_name = @column_name

	delete from md_fields where fld_table_name = @table_name and fld_field_name = @column_name

	--exec p_sys_drop_column @table_name, @column_name
end
