It depends on the shock. A lot of stock shocks have caps that are swaged or crimped, so they cannot be easily rebuilt. A machine shop can re-work anything--machine internal threads, custom make threaded top and bottom caps, etc.--but it's cheaper to buy an aftermarket shock, like a Works shock, that is already threaded so that can it be rebuilt. Even then, it can take special tools to screw off the top and/or bottom caps, and you will need to order a rebuild kit with the correct bushings, seals, and o-rings, unless you rebuild enough shocks that you already have all of those parts on hand. If the shaft is scored or worn, your shock could be a goner. Also, many shocks need to be recharged with nitrogen. Do you have a gas cylinder full o' high pressure nitrogen with a regulator handy?
Assuming you have a rebuildable shock, the easy way is to Google [your state or city] motorcycle suspension and see if there is a dude into dirt bikes who has a little garage business with the correct tools, spare parts, and an N2 cylinder. Might cost something, but it will be cheaper than a new shock.
Or, it might be a good time to buy an aftermarket shock that can be rebuilt.