you really shouldn't mess with these things if you don't know what you are doing. just let the wallet do it in the background itself.
(1) easy but not safe or recommended way:
search the address on blockchain.com:
https://www.blockchain.com/en/btc/address/3QJmV3qfvL9SuYo34YihAf3sRCW3qSinyCthere is a field called "Hash 160" copy that, add a914 to its beginning and 87 to its end:
a914f815b036d9bbbce5e9f2a00abd1bf3dc91e9551087
(2) "the right way" to "convert" a given address to its equivalent scriptPubkey is to first check if the given address is valid using either one of two encodings used by bitcoin addresses (base58 and bech32) then based on decoded data you set the appropriate the script:
1. check starting characters of the given string -> if 1 or 3 then use base58, if bc1 then use bech32 (different for testnet)
3QJmV3qfvL9SuYo34YihAf3sRCW3qSinyC
2. it is 3 -> decode with base58, verify and remove the 4 byte checksum
decoded: 05f815b036d9bbbce5e9f2a00abd1bf3dc91e95510cd003107
data: 05f815b036d9bbbce5e9f2a00abd1bf3dc91e95510
expected checksum: cd003107
double sha256 of data: cd00310784cb5c11ef41396565fa524c0fcefc05eaefa52740a50aaafaaaf9cf
actual checksum: cd003107
expected == actual
return data
3. check version byte, figure out type of script and remove it
0x05 => P2SH script
4. check validity of the length of remaining data, that's your hash
f815b036d9bbbce5e9f2a00abd1bf3dc91e95510 => 20 bytes => correct
5. write the appropriate script:
for P2SH this is
OP_HASH160
OP_EQUAL
a9 14-f815b036d9bbbce5e9f2a00abd1bf3dc91e95510 87
ps. this is for P2SH scripts, the PublicScript for other types is different from this.