If the common bile duct is in spasm, or a stent was placed the pain should typically be controlled with use of medications that are non-narcotic based. Narcotic meds are notorious for raising pressure in the ducts of the biliary and can result in more acute discomfort and pain. The docs may suggest a combination of meds that may include specific anti-spasm meds to reduce the pain/discomfort but it may take a few days for the pain discomfort to subside.
Welcome to the gastroenterology community! You shouldn't really be having paun after an ERCP. I would recommend talking to your doctor about this,