You can cancel the query by using
SQLCommand.Cancel method[
^] But remember, the command must be running in another thread, otherwise Cancel method will be called after the command is finished.
Another method is to specify a CommandTimeout to cancel query executing when it runs over a specified time limit.