if not exists (select 1 from sys.procedures where name ='mob_plantillaListaChequeo') 
begin
execute (' 
CREATE PROCEDURE mob_plantillaListaChequeo 
	@p_id_OT int 
AS
BEGIN
	
	SET NOCOUNT ON;

   SELECT CLA.id_atributo id
   ,CLA.cat_atributo_atributo as item
   ,SA.seccionAtributo as seccion
   ,CLA.cat_atributo_id_tipoAtributo as tipo
   ,dbo.f_opcionesAtributo(CLA.id_atributo,1) as IDsOpciones
   ,dbo.f_opcionesAtributo(CLA.id_atributo,0) as textosOpciones
   ,CLA.cat_atributo_esVariable as esVariable
   ,CLA.orden as orden
   --,NI as rango
   ,CLA.id_pruebaCheckList as id_lista
   ,CLA.cat_atributo_esObligatorio as obligatorio
   ,CLA.cat_atributo_valorMinimo minimo
   ,CLA.cat_atributo_ValorMaximo maximo
   ,UNI.unidad as unidad
   FROM view_cat_pruebaCheckList_atributo CLA
   INNER JOIN cat_seccionAtributo SA on SA.id=CLA.cat_atributo_id_seccionAtributo
   INNER JOIN gen_unidad UNI on UNI.id=CLA.cat_atributo_id_unidad
   WHERE CLA.id_pruebachecklist=1 and CLA.active=1

END
')
end
