Check out example codes for "executescalar in sql server". It will help you in understanding the concepts better.

Code Example 1

DECLARE @IsDuplicate BIT
  	    
		IF EXISTS(SELECT * FROM dbo.ListData WHERE [description] = @description AND [dataTypeId] = @dataTypeId) -- Checking if duplicate name
					SET @IsDuplicate = 1

	    ELSE
			BEGIN
            
            END

Learn ReactJs, React Native from akashmittal.com