IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[userfunc_562_whcheck]') AND type = 'P')
DROP PROCEDURE [dbo].[userfunc_562_whcheck]
GO
CREATE PROCEDURE userfunc_562_whcheck(@cmpid int,   @branchid int,  @userdpid int,  @useruid int,   @userotid int,  @usersecurity int,@ctgid int,@ctgid2 int,@objid bigint,@id1 int,@id2 int)
as
begin



      select ord2_cuid,ord2_creator 
      from order_241_2  
      where ord2_ordid = @id1 and ord2_id =@id2 and ord2_cuid != @useruid


end