The text of Order 66 as given in Chapter Twenty of the novel "Star Wars Republic Commando: True Colors" reads:
In the event of Jedi officers acting against the interests of the Republic, and after receiving specific orders verified as coming directly from the Supreme Commander (Chancellor), GAR [Grand Army of the Republic] commanders will remove those officers by lethal force, and command of the GAR will revert to the Supreme Commander (Chancellor) until a new command structure is established.
It sounds like a big established rule. It was even known by a huge no. of clones (that's why they were able to follow it).
And, there wasn't any known opposition against this rule. So, I can assume that it wasn't known to the Jedi because if it was, they would have opposed it because its not a good rule (killing all because of one).
How is it possible? The Jedi were known to keep track of everything around them. Plus, they were able to feel it from mind of clones.
Update:
After a recent answer saying the quoted text doesn't say that order 66 was meant for all Jedi, I decided to clarify this because a very old comment (by @BenVoigt) says the same thing:
But you're misreading the rule. It doesn't say "remove all Jedi", it says "remove those officers" (the ones committing treason).
I would like to counter this with the last information in the quote:
In the event of Jedi officers acting against the interests of the Republic, and after receiving specific orders verified as coming directly from the Supreme Commander (Chancellor), GAR [Grand Army of the Republic] commanders will remove those officers by lethal force, and command of the GAR will revert to the Supreme Commander (Chancellor) until a new command structure is established.
If you can interpret the bolded part well, it means "all" Jedi were the targets. You don't really need a new command structure if only a few Jedi get killed (which used to happen a lot).
It should also be clear from the movies as noted by @AndresF in the comment:
@BenVoigt Judging just from the movies, didn't the clones try to get rid of all the Jedi? I don't see any procedure to get rid of just the so-called "traitor" Jedi. We see the clone commanders receiving a message to "execute Order 66", then try to kill all Jedi on sight, without checking whether they are traitors. It seems to me, in practice, the rule does say "kill all Jedi" (maybe the books clarify this?)