If I understand you correctly, you want to take an existing free-software project, and make enough modifications to make it detectably different from the original code. You want to know if you can then make this new product proprietary. In short, and IANAL/IANYL, it depends on the original licence.
Your new work is what we call a derivative of the old work; making and distributing a derivative are things controlled by copyright, so you need permission to do those.
- Some free licences (permissive licences like MIT, BSD) permit you to make proprietary products from the original codebase, and no significant conditions are attached to this grant. You don't even have to modify the original code to be allowed to redistribute.
- Other free licences (copyleft licences like GPL, AGPL) also permit it, but require that whatever you distribute (original or modified) be distributed under the same licence terms as the original. In many jurisdictions, no amount of modification will make your work not be a derivative.
So the extent to which ERP-B differs from ERP-A doesn't affect the answer. The licence on ERP-A does.