CREATE PROCEDURE [dbo].[sp_produce_maxvalue] @returncode int output as declare @seqid varchar(50) declare @retmaxValue int begin set @seqid = 'blood' exec [dbo].[sp_getnextseq_new_blood] @seqid = @seqid,@retcode = @retmaxValue output ; set @returncode = @retmaxValue print @returncode end GO