Endoscopic retrograde cholangiopancreatography, or ERCP, is a test that can locate and remove stones in the ducts.