Anakin was an «unknown» factor in Palpatine’s goals, he did not know that Anakin would turn to the Dark Side, so when Order 66 was sent out to the Clone Troopers how did the 501st know not to kill Anakin?
What if another Jedi like Obi-Wan was the one that helped Palpatine and not Anakin would Order 66 have prevented the Clones from killing Obi-Wan and shoot Anakin instead?
I like the idea that they were specifically programmed not to target Anakin .
Lets be realistic. If Anakin had not turned, and order 66 was executed anyway, having all the Jedi killed would have made it easier to convert Anakin to the dark side. Palpatine, the master manipulator, could have easily told Anakin some lie about the reason why the clones turned on the Jedi. He could have even suggested it was all Anakin’s fault. Anakin’s guilt would have set the seed for turning him.