Your question is lacking in detail. Can you confirm what SQL tables you have. It looks like you're trying to count the number of rows in a table and return a value depending on that. Is it just total rows in the table or based on some condition. The following might help you
CREATE PROCEDURE SampleProc
AS
BEGIN
DECLARE @RowCount int
SELECT @RowCount = COUNT(*) FROM project
IF @RowCount = 0
BEGIN
RETURN 1
END
IF @RowCount > 0 AND @RowCount < 5
BEGIN
RETURN 0
END
RETURN -1
END
GO
DECLARE @RC int
EXEC @RC = SampleProc
PRINT @RC
or as a function:
CREATE FUNCTION dbo.SampleFunc() RETURNS int
AS
BEGIN
DECLARE @RowCount int
SELECT @RowCount = COUNT(*) FROM project
IF @RowCount = 0
BEGIN
RETURN 1
END
IF @RowCount > 0 AND @RowCount < 5
BEGIN
RETURN 0
END
RETURN -1
END
GO
select dbo.SampleFunc()