First let's establish what is meant when we talk about open source code.
Code that is published without any license attached to it, is open but proprietary. The copyright of that code belongs to the developer who wrote it. You need to obtain permission from the author to use it.
This author can release that code under a license. If that license is approved by the Open Source Initiative (OSI) then that code isn't only open, it's also open source.
Code that is open source can't be proprietary. The original author still had the coyright (that's inalienable in many jurisdictions), but with the open source license the author grants at least 10 rights (defined by OSI) to everyone who obtains a copy of the source code.
Among those rights are the irrevocable freedom to use, to redistribute, to create derived works, and so on.
There is proprietary code that is distributed along with the binaries under a different license (e.g. the Business Source license used by MariaDB for clustering databases), but although that code is open, it isn't open source because the Business License wasn't approved by OSI.