I would like to know is there anyway to tell SQL for running query till mentioned time frame (let's say for 5 min)?

If query not executed within given time frame, is there anyway to get error message or error code or something thru which i will come to know that query did not run?

Thanks in advance for help.