IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sel_atributosOpcionesAtributo_checked]') AND type in (N'P', N'PC'))
BEGIN
execute('
	create PROCEDURE [dbo].[sel_atributosOpcionesAtributo_checked] 
		@p_idCheckList int
	AS
	BEGIN
	
		SET NOCOUNT ON;
	
		select aoa.id id, aoa.id_atributo id_atributo, aoa.id_opcionAtributo id_opcionAtributo
		from cat_atributo_opcionAtributo aoa 
			inner join cat_pruebaCheckList_atributo pcl 
		on aoa.id_atributo = pcl.id_atributo
		where pcl.id_pruebaCheckList = @p_idCheckList and 
			aoa.active = 1 and 
			pcl.active = 1
   
	END

	')

END