When your bike was made 9mm was the correct thickness of nut. In cases where there was a problem with it coming loose the Yamaha fix was to replace the nut with a 12mm thick nut. Also if the threads on the gearbox shaft where not as they should be, to replace the shaft.
When fitting a new sprocket it would seem prudent to fit the 12mm nut at the same time. Some folks chose to replace the 9mm nut with a 12mm nut just for peace of mind, (that's what I did), others consider this a bit over the top. Either way using the correct torque and thread lock as well as the locking washer is still important.