The original formulation by economist Charles Goodhart (1975):

“Any observed statistical regularity will tend to collapse once pressure is placed upon it for control purposes.”

The pithier version you’re paraphrasing is Marilyn Strathern’s 1997 reformulation:

“When a measure becomes a target, it ceases to be a good measure.”

Strathern’s version is the one most people quote — it’s cleaner than Goodhart’s original.