Of course. I can’t speak Swiss German but I had absolutely no trouble conversing with people in Zürich, Bern, or Luzern. Everyone was totally fluent in Hochdeutsch and more than willing to speak it for my benefit.
If you want to stay in Switzerland long term, learning the dialect is a great idea but nobody will expect non-Swiss to know any of the Swiss dialects.
Many Germans and Austrians live in Switzerland and they get by using standard German all the time, although after a while, locals will start to use dialect around German speakers who’ve been there “long enough”.
I’ve talked about this with some German acquaintances living in Zug and Winterthur and they talk about how, although they still use Hochdeutsch rather than dialect themselves, they can understand the dialect now and their Swiss friends no longer bother to code switch around them.