IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[a_sel_cat_obtenerInventario]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[a_sel_cat_obtenerInventario]
GO
CREATE PROCEDURE  [dbo].[a_sel_cat_obtenerInventario]
@p_idCatalogo int
as begin
   SELECT  distinct
   gen_bodega_bodega  as Bodega
  ,existencia as Cantidad
  FROM [view_cat_catalogo_bodega] 
  where active= 1 and id_catalogo =@p_idCatalogo
  order by existencia desc
End 