dazfuller is correct in that you cannot conflate IP and copyright. Copyright protection is a certain type of IP protection that can be afforded to certain types of tangible creative works. But "IP" is a much broader concept than just copyright.
There's a lot of focus in the law about core types of IP that are protected by statute: copyright, trademark, patent.
It is quite possible that the type of cool technique you develop while doing code for a customer wouldn't be protected by copyright, trademark, or patent law. But most customers probably want you to enter into a contract that governs ownership of IP.
By contract, you can protect certain types of IP that, for example, wouldn't be subject to copyright protection. Depending on what is in your contract with your customer, you may end of inadvertently winding up with your customer "owning" any technique, idea, know-how, etc...that you come up with in the course of performing services with the customer. ("Owning" this type of IP is not the same as "owning" certain other types of IP, as concerns 3rd parties. But that's not particularly important for your question.)
Even if the customer couldn't sue you for copyright infringement for using a technique they end up "owning" by contract, they might be able to sue you for breach of contract or trade secret misappropriation, depending on how you use the technique and its value proposition to the customer. Or, if the technique is patentable, they might be able to apply for a patent covering the technique and prevent you from using the technique that way.
There are a number of ways to work around this in your customer licenses. How, exactly, depends on what you are doing for your customer, what your customer does, and your negotiating leverage. But it's certainly doable and happens everyday.