No, Alfred Hitchcock never wore a cowboy hat in any of his 50+ cameo appearances. His signature walk-ons—one per film—are a cinema trademark, but they follow a strict, understated pattern:
The cowboy hat is iconically tied to Western directors like John Ford or Howard Hawks, or to parodies (e.g., The Simpsons, Family Guy) that exaggerate Hitchcock's silhouette. If you recall a Stetson-topped cameo, it's almost certainly a homage or misattribution.
Hitchcock's cameos are a game of "spot the director"—subtle, consistent, and always in character as a dapper, slightly bemused Londoner in a thriller. The cowboy hat simply isn't part of his uniform.