The Salzburg Festtage (a theatre/opera festival) starts on the 23rd July, so if you're looking directly in and around S'burg it could well be full, and treble the price - so I'd seriously pre-book there. However, I'd suggest somewhere a bit further away, westwards say Zell am See, Kaprun, Saalfelden; or eastwards say Gosau, ..anywhere on the lakes (Bad Ischl, Bad Ausssee, Gmunden, Mondsee, St. Wolfgang) depending on which roads you're likely to be riding. Consider tiddly little places like Werfen (with its castle Hohenwerfen). Most towns and villages will have a couple of B&Bs or private rooms - all you need then is a place with a restaurant & bar.
Andermatt is pretty small but there are a fair number of private B&Bs in the village. If Andermatt is full, don't forget to try Realp, further up the valley.
I've never stayed in St. Moritz - only in Silvaplana once (bring a gold credit card), and even off-peak Silvaplana was not easy, you may want to consider pre-booking there if you want to be sure of getting an affordable room.
Personally I always just wing it. Sometimes it can mean trying a few places before you get lucky, but mostly it works out ok. You can get some nice little surprises too that way. As Mark suggested on another thread, it's not a bad idea to try and find a room early, say mid afternoon. Before the late arrivals turn up. Then you can dump the luggage and go out for the rest of the day's ride, with no worries about being back too late. It can also provide a way of avoiding the mid-afternoon thunderstorms.
