Looks like a vent to me.
It's hard to say without seeing where it's connected. I could be a vent for a house trap.
There at one time was a fixture there and the line you're referring to was a vent for that fixture.
I don't see a 2" vent connection that you took a picture of. You have a back water valve installed.
You have a capped line there that at one time connected to something that was vented with the line running up the outside of the building.
Enter your email address to join: