IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_g_saleprds_bigcategory]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_g_saleprds_bigcategory]
GO
create procedure [dbo].[mps_g_saleprds_bigcategory](
@cmpid int,
@mycuid int , 
@sptype nvarchar(30) 
) as
begin
set nocount on
select distinct sp_category1 , sp_category1 sp_category111  from mps_saleprds with(nolock) 
where sp_cmpid=@cmpid and (@mycuid=0 or sp_cuid=@mycuid) and sp_use=0 and sp_type=@sptype
order by sp_category1 
set nocount off 
end