IF NOT EXISTS (SELECT * FROM SYS.COLUMNS WHERE NAME = 'NM_PROGRAMA' AND OBJECT_ID = OBJECT_ID('RC_CLI_CONV_RC_CLI_AUDITORIA'))
BEGIN	
	ALTER TABLE RC_CLI_CONV_RC_CLI_AUDITORIA ADD NM_PROGRAMA VARCHAR(MAX)  NULL;
	ALTER TABLE [dbo].[RC_CLI_CONV_RC_CLI_AUDITORIA] ADD  CONSTRAINT [DF_RC_CLI_CONV_RC_CLI_AUDITORIA_PROGRAM_NAME]  DEFAULT (program_name()) FOR [NM_PROGRAMA]
END

IF NOT EXISTS (SELECT * FROM SYS.COLUMNS WHERE NAME = 'HOST' AND OBJECT_ID = OBJECT_ID('RC_CLI_CONV_RC_CLI_AUDITORIA'))
BEGIN	
	ALTER TABLE RC_CLI_CONV_RC_CLI_AUDITORIA ADD HOST VARCHAR(MAX)  NULL;
	ALTER TABLE [dbo].[RC_CLI_CONV_RC_CLI_AUDITORIA] ADD  CONSTRAINT [DF_RC_CLI_CONV_RC_CLI_AUDITORIA_AUDIT_HOST]  DEFAULT (host_name()) FOR [HOST]
END

IF NOT EXISTS (SELECT * FROM SYS.COLUMNS WHERE NAME = 'IP_CLIENTE' AND OBJECT_ID = OBJECT_ID('RC_CLI_CONV_RC_CLI_AUDITORIA'))
BEGIN	
	ALTER TABLE RC_CLI_CONV_RC_CLI_AUDITORIA ADD IP_CLIENTE SQL_VARIANT  NULL;
	ALTER TABLE [dbo].[RC_CLI_CONV_RC_CLI_AUDITORIA] ADD  CONSTRAINT [DF_RC_CLI_CONV_RC_CLI_AUDITORIA_IP_CLIENTE]  DEFAULT (connectionproperty('CLIENT_NET_ADDRESS')) FOR [IP_CLIENTE]
END

