This is a utility datapack I use in my other datapacks.
It adds a scoreboard objective that is set to 1 if the player is crouching.
Installation:
Download the zip and drop it in your datapack folder. Either reload your world (singleplayer) or run the /reload command