I would suggest you to use IF NOT EXISTS condition in your query to check for already existence of records.
IF NOT EXISTS (SELECT CODE FROM STATE WHERE CODE = ????)
BEGIN
--INSERT RECORD HERE
END
This way you will have a single call to database table.