There can be a huge difference depending on how you go about it. You can get an idea by talking to Jasper - www.jasperengines.com
- about swapping for a rebuilt. They have a very good reputation for product and support. I would expect that their price would be on the high side of average, because they have to assume that the engines they get back will be in pretty bad shape.
If you take your engine to a shop the cost will depend on how bad it is, which won't be known until its disassembled. A rebuild can be as little as honing the cylinder walls and replacing gaskets, rings and bearings. At the other end of the spectrum it will require boring, new pistons, grinding the crank, new cam and lifters, new oil pump and on and on. The real condition of your engine is going to determine how expensive a rebuild gets.
If you decide to have a local shop do the rebuild, more important than cost is their competence. Rebuilding an engine isn't a black art - it's very widely known what needs to be done and how to do it. A shop that takes shortcuts can save hours off the job, but the engine may be good for only 10K miles instead of 100K.
And a final thought, if you have the room to work, consider doing it yourself; it's really not difficult. Just study up on the general procedures first, get a good manual, buy a few special tools, and take your time. You can save a lot of money, learn something, and wind up with a good engine. And more tools. Tools are always good to have!