Well, according to this fascinating article, the trick may not be in keeping your head from moving; rather, it be in training your head to move in an egocentric manner.
Apparently, good golfers and duffers both move their heads. The difference is that duffers move their noggin’ in the direction of the putt — in an allocentric manner. Good golfers move their heads in an opposite direction of their putter. It is theorized that this egocentric act helps them better maintain a stable, central body position by counter-acting the destabilization caused by the putter moving in the opposite direction.