You can demagnetize a piece by magnetizing it with AC.
The secret to demagnetizing a work piece is to remagnetize it with a field that is stronger than the residual magnetic field that is giving you problems. The residual magnetic field can be the result of machining the part secured with a magnetic chuck, from grinding or machining the beveled edge, welding with DC, or in some cases it can be the result of the magnetic field encircling the earth. Remember, the earth is a huge magnet which can magnetize long components transported in a northerly/southerly direction. This can be very troublesome with long members such as pipe, beams, and rods.
AC power supplies can be used very effectively to demagnetize various shapes using the "coil" or "cable wrap" technique. In the case of pipe, run several wraps of welding lead through the length of the pipe. This induces a circular field around the circumference of the pipe when it is energized with AC current. Start with high current and then reduce it. Remove a wrap of welding lead and energized the current again, starting with high current and reducing it to low current. Clearly, if your welder only has taps to reduce the current you will have to open the circuit each time you reduce the current. The easiest way to make a switch for the current is to short out the "stinger" on a piece of scrap and then break the arc before reducing the current by selecting a lower current setting.
Once you have reduced the number of cable wraps to 1, wrap the welding lead around the pipe several times. This will induce a longitudinal field so that one end of the pipe is the North Pole and the other the South Pole. Using AC current causes the polarity of the magnetic field to change many times per second (depending of the cycles used, i.e., 60 Hz or 50Hz). Once again, energize the circuit using high current and reduce the current. Repeat the steps after removing a wrap of welding lead until there are no more wraps to remove.
If performed properly, you should be able to hold a paper clip to the end of the pipe and it should fall to the ground if the magnetic field is reduced sufficiently.
This same procedure can be performed with DC, but it is more laborious because you have to switch the polarity of the welding machine at the end of each current cycle. Wrap the leads, energize with high current, reduce the current, remove a wrap, switch the welding leads to change polarity, start with high current moving to low current, remove a wrap and repeat. This should be performed using approximately 30 steps, each at a lower current, fewer wraps, and current reversals.
The sketch shows the general layout and the "make/break" switch. Remember to start with the welding leads passing through and around the pipe to create a circular field, followed by the welding leads wrapped around the pipe to create a longitudinal field. The embedded sketch shows the latter.
Best regards - Al
Happy Memorial Day