if exists (select 1 from syscolumns 
inner join systypes on syscolumns.xtype = systypes.xtype
where id = object_id('EST_PROD_CPL_DEMANDA_PROC') and syscolumns.name = 'CD_USU' and systypes.name like 'nchar')
begin
	ALTER TABLE dbo.EST_PROD_CPL_DEMANDA_PROC DROP CONSTRAINT DF_EST_PROD_CPL_DEMANDA_PROC_CD_USU
end
GO
if not exists (select 1 from syscolumns 
inner join systypes on syscolumns.xtype = systypes.xtype
where id = object_id('EST_PROD_CPL_DEMANDA_PROC') and syscolumns.name = 'CD_USU' and systypes.name like 'int')
begin
ALTER TABLE EST_PROD_CPL_DEMANDA_PROC ALTER COLUMN CD_USU INT

ALTER TABLE dbo.EST_PROD_CPL_DEMANDA_PROC ADD CONSTRAINT
	DF_EST_PROD_CPL_DEMANDA_PROC_CD_USU DEFAULT 0 FOR CD_USU
end
go
if exists (select 1 from syscolumns 
inner join systypes on syscolumns.xtype = systypes.xtype
where id = object_id('EST_PROD_CPL_DEMANDA_PROC') and syscolumns.name = 'TP_DEMANDA' and systypes.name like 'nchar')
begin
	ALTER TABLE dbo.EST_PROD_CPL_DEMANDA_PROC DROP CONSTRAINT DF_EST_PROD_CPL_DEMANDA_PROC_TP_DEMANDA
end
GO
if not exists (select 1 from syscolumns 
inner join systypes on syscolumns.xtype = systypes.xtype
where id = object_id('EST_PROD_CPL_DEMANDA_PROC') and syscolumns.name = 'TP_DEMANDA' and systypes.name like 'int')
begin
ALTER TABLE EST_PROD_CPL_DEMANDA_PROC ALTER COLUMN TP_DEMANDA INT

ALTER TABLE dbo.EST_PROD_CPL_DEMANDA_PROC ADD CONSTRAINT
	DF_EST_PROD_CPL_DEMANDA_PROC_TP_DEMANDA DEFAULT 0 FOR TP_DEMANDA
end
go
if not exists (select 1 from syscolumns 
inner join systypes on syscolumns.xtype = systypes.xtype
where id = object_id('EST_PROD_CPL_DEMANDA_PROC') and syscolumns.name = 'DT_PROC' and systypes.name like 'datetime')
begin
ALTER TABLE EST_PROD_CPL_DEMANDA_PROC ALTER COLUMN DT_PROC DATETIME
end