A Woodruff key (a semicircular piece of the end of rod, to fit into the slot cut into the side of your shaft) will do a nice job if you have a milling machine, as will a longitudinal milled slot and a length of square keystock. Both require a key way in the hub of sprockets and gears, which is why so many have them. Another way, is the split hub which pulls the gear / sprocket / pulley onto itself to provide the locking force.
You could always use Locktite (sp?)
