Chris Shaw shows how to stop SQL Agent jobs programmatically:
SQL Server has a number of system stored procedures that you can use to perform tasks that you might be doing in the user interface, for example… If you want to stop a job you can open SQL Server Management Studio, navigate to the job, right click and stop the job. Here is where the system supplied stored procedure comes into play. What if your busy time of the day is at 6 AM, and you want to make sure that the indexing has finished by 5:00 AM so that the system is ready to take on the day. Do you really want to wake up at 5:00 AM just to right click and stop job, in the chance that it is running?
The answer to Chris’s question is no, I’d much rather not wake up at 5 AM to stop a job if it’s running. This is why we have computers, to do that sort of thing for us.