Yes, if you purchase a dedicated .22lr upper, you can just switch it out. To be clear, it has to be a true AR upper with a .22lr barrel and bolt assembly... The M&P 15-22 will not fit on a 5.56 lower.
Your other option is to just use the .22lr bolt conversion kit, but these are not as accurate as a dedicated upper. But they are cheaper.
I have a CMMG .22lr upper, on a CMMG lower with a Redi Mag adapter installed that allows me to use M&P 15-22 magazines. Bolt locks open when empty, so functions just like the 5.56.