
declare @constraint as varchar(3000)
declare @comando as varchar(3000)
SELECT * FROM dbo.sysobjects WHERE  parent_obj = OBJECT_ID('cat_catalogo_listaprecio') and name like 'FK_cat_catalogo_listaPrecio_id_moneda%'
BEGIN
SELECT @constraint =name FROM dbo.sysobjects WHERE  parent_obj = OBJECT_ID('cat_catalogo_listaprecio')  and name like 'FK_cat_catalogo_listaPrecio_id_moneda%'
set @comando='ALTER TABLE [dbo].[cat_catalogo_listaprecio] DROP CONSTRAINT ' +@constraint 
exec(@comando)
print(@comando)

SELECT @constraint =name FROM dbo.sysobjects WHERE  parent_obj = OBJECT_ID('cat_catalogo_listaprecio')  and name like 'DF__cat_catal__id_mo%'
set @comando='ALTER TABLE [dbo].[cat_catalogo_listaprecio] DROP CONSTRAINT ' +@constraint 
exec(@comando)
print(@comando)
END

if exists (select * FROM INFORMATION_SCHEMA.COLUMNS  where Table_Name='cat_catalogo_listaprecio' and column_name = 'id_moneda')
begin
ALTER TABLE [dbo].[cat_catalogo_listaprecio] DROP column id_moneda

end 
