UPDATE [gui_funcionalidad] 
SET [id_aplicacion] = (SELECT [id] FROM [gui_aplicacion] WHERE [aplicacion_codigo] = 'SAMMWEB') 
WHERE 
	[id_aplicacion] = 0 AND 
	[active] = 1

IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'gui_funcionalidad' AND COLUMN_NAME = 'esMvc')
BEGIN
	UPDATE [gui_funcionalidad] 
	SET [id_aplicacion] = (SELECT [id] FROM [gui_aplicacion] WHERE [aplicacion_codigo] = 'MVC') 
	WHERE 
		[esMvc] = 1 AND 
		[active] = 1
END