Exists function is used for checking whether record is there in table or not.It returns true if record is present otherwise returns false.
For Example:-
IF NOT EXISTS (SELECT code_id FROM code_details WHERE code_value ='SUBM')
BEGIN
INSERT code_details(code_id,code_value,created_by,created_date)
VALUES (1,'SUBM','RAJESH.S',getdate())
END
ELSE PRINT 'Already Exists.';