You can go to your local farm supply and buy 2 set screw collars and butt them up to the key way on both sides to lock it in place. Or if the key way is long enough and not completely inside the sprocket, put a hose clamp on the exposed key.
Oh! Mckutzy beat me to the punch. I guess a guy could clean the axle really well and Gorilla tape the key to the axle.
The keys themselves are rather soft,
clamping it in your vice and mushrooming it out ever so slightly on the lower half with some gentle percussive action
could require you to tap it into the keyway with that very same hammer.. and ideally would hold it in place all by itself!
but truth is: locking collars or set screws are reliable and most of all repeatable (just not as easy to get on a sunday )
So yeah, lots of options
superglue is said to work as well.. to remove it you just have to heat it up and it'll crack open again,
just in case you want to fix it (at least temporarily) today